package com.cta.utils;

import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang.StringUtils;

public class DateUtil {

	private static Map<String, SimpleDateFormat> formats = new HashMap<String, SimpleDateFormat>();

	/**
	 * create new and cache format date
	 * @param format
	 * @return
	 */
	public static SimpleDateFormat getFormat(String format) {
		SimpleDateFormat sf = formats.get(format);
		if (sf == null) {
			sf = new SimpleDateFormat(format);
			formats.put(format, sf);
		}
		return sf;
	}
	
}
